<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<%@include file="../../common/taglib/taglib.jsp" %>
<%@include file="../common/dwz.jsp" %>
<head>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="images/favicon.png" type="image/png">
    <title>传感器更新</title>
    <link href="${baseURL}/dwz/css/style.default.css" rel="stylesheet">
    <link href="${baseURL}/dwz/css/jquery.datatables.css" rel="stylesheet">

</head>


<body>

<!-- 左侧导航栏开始-->
<c:import url="../common/left.jsp"></c:import>
<!-- 左侧导航栏结束-->
<div class="mainpanel">

    <!-- 头导航栏开始-->
    <c:import url="../common/hander.jsp"></c:import>
    <!-- 头导航栏结束-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">传感器信息</h4>
        </div>
        <div class="panel-body panel-body-nopadding">

            <input id="sensorid" type="hidden" value="${sensor.id}">
            <div class="form-horizontal form-bordered">
                <div class="form-group">
                    <label class="col-sm-3 control-label">指标类型:</label>
                    <div class="col-sm-6">
                        <input id="indexType" type="text" class="form-control" ${sensor.indexType} />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">传感器位置:</label>
                    <div class="col-sm-6">
                        <input id="sensorPosition" type="text" value="${sensor.sensorPosition}"
                               class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">桥跨:</label>
                    <div class="col-sm-6">
                        <input id="bridgeSpan" type="text" value="${sensor.bridgeSpan}" class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">排序:</label>
                    <div class="col-sm-6">
                        <input id="sort" type="text" value="${sensor.sort}" class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">传感器编号:</label>
                    <div class="col-sm-6">
                        <input id="sensorNumber" type="text" value="${sensor.sensorNumber}" class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">类型:</label>
                    <div class="col-sm-6">
                        <input id="type" type="text" value="${sensor.type}" class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">中心波长(nm):</label>
                    <div class="col-sm-6">
                        <input id="centreWavelength" type="text" value="${sensor.centreWavelength}"
                               class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">保护带宽(nm):</label>
                    <div class="col-sm-6">
                        <input id="bandwidth" type="text" value="${sensor.bandwidth}" class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">传感器系数:</label>
                    <div class="col-sm-6">
                        <input id="sensorCoefficient" type="text" value="${sensor.sensorCoefficient}"
                               class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">补偿传感器编号:</label>
                    <div class="col-sm-6">
                        <input id="offsetSensorNumber" type="text" value="${sensor.offsetSensorNumber}"
                               class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">补偿系数:</label>
                    <div class="col-sm-6">
                        <input id="offsetCoefficient" type="text" value="${sensor.offsetCoefficient}"
                               class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">公式:</label>
                    <div class="col-sm-6">
                        <input id="formula" type="text" value="${sensor.formula}" class="form-control"/>
                    </div>
                </div>
            </div>


        </div><!-- panel-body -->

        <div class="panel-footer">
            <div class="row">
                <div class="col-sm-6 col-sm-offset-3">
                    <button id="save" type="button" class="btn btn-primary">提交</button>&nbsp;
                    <a href="/bizSensorConfigController/sensor/1" class="btn btn-default">返回</a>
                </div>
            </div>
        </div><!-- panel-footer -->

    </div><!-- panel -->

</body>


<script>

    $("#save").click(function () {

        debugger

        var id = $("#sensorid").val();
        var indexType = $("#indexType").val();
        var sensorPosition = $("#sensorPosition").val();
        var bridgeSpan = $("#bridgeSpan").val();
        var sort = $("#sort").val();
        var sensorNumber = $("#sensorNumber").val();
        var type = $("#type").val();
        var centreWavelength = $("#centreWavelength").val();
        var bandwidth = $("#bandwidth").val();
        var sensorCoefficient = $("#sensorCoefficient").val();
        var offsetSensorNumber = $("#offsetSensorNumber").val();
        var offsetCoefficient = $("#offsetCoefficient").val();
        var formula = $("#formula").val();

        var data = {
            id:id,
            indexType: indexType, sensorPosition: sensorPosition, bridgeSpan: bridgeSpan,
            sort: sort, sensorNumber: sensorNumber, type: type,
            centreWavelength: centreWavelength, bandwidth: bandwidth, sensorCoefficient: sensorCoefficient,
            offsetSensorNumber: offsetSensorNumber, offsetCoefficient: offsetCoefficient, formula: formula
        };

        $.ajax({
            url: "/bizSensorConfigController/update/",
            type: "POST",
            data: data,
            success: function (result) {
                debugger
                alert("修改成功")
                window.location.href = "/bizSensorConfigController/sensor/1"
            },
            error: function (result) {
                alert("修改失败")
            }
        });

    })


</script>


</html>